package com.hn658.groupshare.common.validate.store;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Repository;

import com.hn658.framework.dataaccess.redis.AbstractRedisDAO;
import com.hn658.framework.shared.entity.BaseEntity;
import com.hn658.groupshare.common.utils.RedisKeyHelper;

@Repository
public class IpStore  extends AbstractRedisDAO<BaseEntity> {
	
	@Autowired
	@Qualifier("redisTemplate")
	@Override
	public void setTemplate(StringRedisTemplate template) {
		super.template = template;
	}
	
	public void saveIpAndAddress(String ip, String address){
		valueOps.set(RedisKeyHelper.frontendIp(ip), address);
	}
	
	public String getIpAndAddress(String ip){
		return valueOps.get(RedisKeyHelper.frontendIp(ip));
	}
}
